﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;

namespace Distrackting.BusinessLayer
{
    public class Mensagens
    {
        public static void AdicionarMensagem(String s)
        {
            if (HttpContext.Current.Session["dist_messages"] == null)
            {
                HttpContext.Current.Session["dist_messages"] = new List<String>();
            }

            ((List<String>)HttpContext.Current.Session["dist_messages"]).Add(s);
        }

        public static List<String> mostrarMensagens()
        {
            if (HttpContext.Current.Session["dist_messages"] != null)
            {
                List<String> lista = new List<String>();

                foreach (String s in ((List<String>)HttpContext.Current.Session["dist_messages"]))
                {
                    lista.Add(s);
                }

                HttpContext.Current.Session["dist_messages"] = null;

                return lista;
            }
            else
            {
                return null;
            }
        }

        public static void AdicionarErro(String s)
        {
            if (HttpContext.Current.Session["dist_errors"] == null)
            {
                HttpContext.Current.Session["dist_errors"] = new List<String>();
            }

            ((List<String>)HttpContext.Current.Session["dist_errors"]).Add(s);
        }

        public static List<String> mostrarErros()
        {


            if (HttpContext.Current.Session["dist_errors"] != null)
            {
                List<String> lista = new List<String>();

                foreach (String s in ((List<String>)HttpContext.Current.Session["dist_errors"]))
                {
                    lista.Add(s);
                }

                HttpContext.Current.Session["dist_errors"] = null;

                return lista;
            }
            else
            {
                return null;
            }
        }

        public static void AdicionarDebug(String s)
        {
            if (HttpContext.Current.Session["dist_debug"] == null)
            {
                HttpContext.Current.Session["dist_debug"] = new List<String>();
                ((List<String>)HttpContext.Current.Session["dist_debug"]).Add("<b>Debug:</b><br>");
            }

            ((List<String>)HttpContext.Current.Session["dist_debug"]).Add(s);
        }

        public static List<String> mostrarDebugs()
        {


            if (HttpContext.Current.Session["dist_debug"] != null)
            {
                List<String> lista = new List<String>();

                foreach (String s in ((List<String>)HttpContext.Current.Session["dist_debug"]))
                {
                    lista.Add(s);
                }

                HttpContext.Current.Session["dist_debug"] = null;

                return lista;
            }
            else
            {
                return null;
            }
        }

    }
}
